<admintpl file="header" />

</head>
<body>
	<div class="wrap js-check-wrap">
		<ul class="nav nav-tabs">
			<li class="active"><a href="{:U('Box/index')}">智能柜列表</a></li>
			<li ><a href="{:U('Box/add_box')}">添加智能柜</a></li>
		</ul>

		 <a class="btn <if condition='($Think.get.is_fenpei neq 1) and $Think.get.is_fenpei neq 2'>btn-danger<else />btn-success</if>" href="{:U('Box/index')}">全部</a>
        <a class="btn <if condition='$Think.get.is_fenpei eq 1'>btn-danger<else />btn-success</if>" href="{:U('Box/index',array('is_fenpei'=>1))}">已分配</a>
        <a class="btn <if condition='$Think.get.is_fenpei eq 2'>btn-danger<else />btn-success</if>" href="{:U('Box/index',array('is_fenpei'=>2))}">未分配</a>
      <!--   <form class="well form-search" method="post" action="{:U('customer/index')}">
            用户名:
            <input type="text" name="customer_name" style="width: 100px;" value="{$customer_name}" placeholder="请输入用户姓名">
            手机号:
            <input type="text" name="mobile" style="width: 100px;" value="{$mobile}" placeholder="用户手机号">
            客户状态：
            <select name="status" style="width:150px;">
            	<option value="-1">全部</option>
            	<foreach name="customer_status_list" item="vo" >
            	    <option value="{$vo['key']}" <if condition="$customer_status eq $vo['key']">selected</if>>{$vo['value']}</option>
            	</foreach>
            </select>
            <input type="submit" class="btn btn-primary" value="搜索" />
            <a class="btn" href="{:U('customer/index')}">清空</a>
        </form> -->
		<table class="table table-hover table-bordered" style="margin-top:20px">
			<thead>
				<tr>
					<th width="10" >ID</th>
					<th width="30" >智能柜编号</th>
					<th width="30" style="text-align:center">1号控制板编号<br/>对应锁编号（1-4）</th>
					<th width="30" style="text-align:center">2号控制板编号<br/>对应锁编号（5-8）</th>
					<th width="30" >添加时间</th>
					<th width="30">操作</th>
				</tr>
			</thead>
			<tbody>
		
				<foreach name="list" item="vo">
				<tr>
					<td>{$vo.id}</td>
					<td>{$vo.number}</td>
					<td>{:getControlBoardNumber($vo['id'])[0]}</td>
					<td>{:getControlBoardNumber($vo['id'])[1]}</td>
					<td>{$vo['add_time']|date='Y-m-d H:i',###}</td>
					<td><if condition="$Think.get.is_fenpei eq 2"><a class="box-fenpei" data-id="{$vo['id']}" data-toggle="modal" data-target="#myModal">分配球房</a></if></td>
				</tr>
				</foreach>
			</tbody>
		</table>
		<div class="pagination">{$page}</div>
	</div>

	<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
	<div class="modal-dialog">
		<div class="modal-content" style="background-color: #ecf0f1;height:100%" >
			<div class="modal-header">
				<button type="button" class="close" data-dismiss="modal" aria-hidden="true">
					&times;
				</button>
				<h4 class="modal-title" id="myModalLabel">
					分配球房
				</h4>
			</div>
			<form class="form-horizontal js-ajax-form well" style="margin-left:30px;height:100%" method="post" action="{:U('Box/box_fenpei')}">
			
				    <select name="club_id">
				    	<option value="0">请选择分配球房</option>
				    	<foreach name="club_list" item="vo">
				    	<option value="{$vo['id']}">{$vo['name']}</option>
				        </foreach>
				    
				    </select>
				    <input name="id" id="box_id" type="hidden" value="">&nbsp;
					<button type="button" class="btn btn-default" data-dismiss="modal">取消
					</button>
					<button type="submit" class="btn  btn-primary js-ajax-submit">确定</button>
			</form>
		</div><!-- /.modal-content -->
	</div><!-- /.modal -->
</div>
	<script src="__PUBLIC__/js/common.js"></script>
	<script type="text/javascript">
        $(".box-fenpei").click(function(){
        	$("#box_id").val($(this).attr("data-id"));
        })

        //点击确定按钮
        // $("#btn-active").click(function(){
        // 	var id  = $("#customer_id").val();
        // 	var url = "{:U('customer/customer_active')}";
        // 	$.ajax({  
	       //      type     : "GET",  
	       //      url      : url,  
	       //      data     : {id:id},  
	       //      dataType : "json",  
	       //      async    : false,
	       //      success  :  function(data){  
	       //                      if(data.status == 1){
	       //                      	window.location.reload();
	       //                      }
	       //                  }  
        //     });  
        // })
	</script>
</body>
</html>